package com.intelligent.mts.da.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by Administrator on 2016/9/5.
 */
public class TcpOutHandler extends ChannelInboundHandlerAdapter {
    public static Logger logger = LoggerFactory.getLogger(ValidateHandler.class);
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        logger.info("Start TcpipOut process.");
        String returnMessage = (String) msg;
        ctx.writeAndFlush(returnMessage);
    }
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        logger.warn("Unexpected exception from com.intelligent.mts.da.handler " + cause);
        ctx.fireExceptionCaught(cause);
    }

}
